package config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016101100662665";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCSOjsookvV1GtvbZ7PTLDs6Onqn1LpgyDmkDwSUBv5/c86feeHMh62bdSSxdKChJZNnWiEeUiiim8bC502lsO5Lb+ymaV8VGjAZSzAqDRwi4TPLN/0dpF+MH/BdX19nP28snCjhhh2HKIlIe3sKaKBMCbFCcgI83TbTP9HzY2FVloRKQQ9jAdq6wg9M4OcLniDBzIKrMS8S5594xgridDwXN2YxEX7BnRwKbVFZ/5L8vZX5py+eZqoYbQaqayasCDtlmbhIJoLCrg1BZk9fq2r+IxCj/+S+tKCBZcv+IhStBreyUp22OyFwx1vu9uI2BV4Cl1Mj8HEC46E/PcOtpAHAgMBAAECggEASnivol0tpCQ/5wr8I3Vacf2ZDC3CSzzGJ8ZzYZw880+pF5ABt1/2NlCvP2TSdjhSWAr/rOAb9vPr6+k5UxDrc0byZ2JK3owaoUmlxiSkOGFF7UFceaNdK9hFaGCO3cdzjoOOTCnCEX05sxGZm3oE0iiUxiraHnznGb0YEhiEp8/yXu+/+Ek6uCwSfRhn/QnXaozj9OwRXMTakk0fE/IOIYRDN/E/+BBoQrppSgIdlicyEt7BLrTqaosyecprv8Asl8i1hjPYdQDSYbDaTFPM4xB13T5mN5DZ3FtC5KNEk/BWwx+VidMFJ4A4kibwSsYcg+AiZ4j4iBL5G/+XWCbICQKBgQDKWh+Y6tlYNERsOR+Y3Ot1Eq5ipkaS4Fb3CNgeLK4LaYiJ7cAZmj+mmue59xT6hXnhM4lmmP9OvN+BcqDaS10itvwHUzinrQ/RDIbJbV+xyj0ejEvLoQ+zwAdB15nGuH1refZWkbBiUqiHgH1nO4Trj2vhFmoMinPSUSWzuwIkywKBgQC4/t1uyiIJaLbVgD1jRPNJ2JRHb6C41B98+tUL0+H52rhnDlyR+r98AkphUCd/oKthYYCrVviepvcWeiFuJYn0CRw3LDYFlN03oJzY7mDULOsDdGkB6gaJdegYpV4YUTobtJLTq6j9G1rUIo9I1rDL2C9gSaoZM9QmZKmUAGKWNQKBgACfqn1ELAtTjepveqNz+t3Pgu4W6RzGyD3WryPYq2ipmJwkOXVavlt7Gr+9/TiQdMG28PN6AT9y4ZV6jvhdRxo2SiyTmxcZN3VDfp7cUXEw2GNht1IXWv8I1nzjdzvfkbNlGtdFd6+15YMVaE2LJ2u6c3CsKwOC4byCN4WITAdlAoGAMedWtn9ChUVBJQDuDmxYMNCC125ubc2THPTRKdqjd/IfknVWVW7N3tcDV5L2xMAD20YhHpdcg/fIacDSadMojrMycFO10vWgY1QpW3+akUH4t7rcZM7LqqMq1BMv+eFXiofAn+cLtBOAAf+8pUp88NBFn3TftOK9VQoMkMc10Q0CgYAxI+GYIRDJ1Jm6cgPVIvVycxZh0iGAbFg/2MkwJsE9A9Z/JRZ/heR09wN0i0vl66pWG6HEErNSS3j7XK1HJjgpK7xD9zOgKE25P8Jckmmk6sKn6J/tI0r/ed55IpC8Lr0KWa1Nj0J0z0QCWi8hKVH7DAnhOuLx5loQ8Vm2Toetaw==";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkjo7KKJL1dRrb22ez0yw7Ojp6p9S6YMg5pA8ElAb+f3POn3nhzIetm3UksXSgoSWTZ1ohHlIoopvGwudNpbDuS2/spmlfFRowGUswKg0cIuEzyzf9HaRfjB/wXV9fZz9vLJwo4YYdhyiJSHt7CmigTAmxQnICPN020z/R82NhVZaESkEPYwHausIPTODnC54gwcyCqzEvEuefeMYK4nQ8FzdmMRF+wZ0cCm1RWf+S/L2V+acvnmaqGG0GqmsmrAg7ZZm4SCaCwq4NQWZPX6tq/iMQo//kvrSggWXL/iIUrQa3slKdtjshcMdb7vbiNgVeApdTI/BxAuOhPz3DraQBwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/movie/book-final.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

